package com.springcloudalibaba.sentinel.controller;

import org.apache.commons.lang3.RandomUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * 消费
 *
 * @author admin
 */
@RestController
public class TestController {
    private final String SERVER_URL = "http://sentinel-provider-sample8002";
    @Resource
    private RestTemplate restTemplate;


    @RequestMapping("/test")
    public String test() {
        return restTemplate.getForObject(SERVER_URL + "/test", String.class);
    }


    @RequestMapping("/sentinelTest")
    public String sentinelTest() {
        return "TestController#sentinelTest " + RandomUtils.nextInt(0, 10000);
    }

}